package com.adam.springbucks.controller;

import com.adam.springbucks.entity.Food;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController("/task2")
public class Task2ndController {
    @Resource
    private Food myFood;

    /**
     * 测试xml配置bean方式
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public String getFood(Integer id) {
        if (myFood.getId() == id){
            return myFood.getName();
        }
        return "吃白饭";
    }

}
